package com.bjpowernode.controller;

import com.bjpowernode.common.result.Result;
import com.bjpowernode.entity.query.TranHistoryQuery;
import com.bjpowernode.service.TranHistoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
public class TranHistoryController {

    private final TranHistoryService tranHistoryService;


    @PostMapping("/api/tran/stage")
    public Result tranStage(@RequestBody TranHistoryQuery tranHistoryQuery) {
        if (tranHistoryService.saveTranHistory(tranHistoryQuery) > 0) {
            return Result.OK("交易阶段更新成功");
        } else {
            return Result.FAIL("交易阶段更新失败");
        }
    }

}
